<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../js/vue.global.js"></script>
    <style>
        .demo1
        {
            color: #00FF00;
            
        }

        .demo2  
        {
            color:#0000FF
        }

    </style>
    <title>一些小例子</title>
</head>
<body>
    <div id="app">
        <h3 :class="textStyleObj">hello world</h3>
        <button @click="changestyle()">切换风格</button>
    </div>

    <script>
        const myApp = {
            data(){
                return {
                    textStyleObj:{
                        demo1: false,
                        demo2: true
                    }
                }
            },
            methods: {
                changestyle()
                {
                    this.textStyleObj.demo1 = this.textStyleObj.demo1 ? false : true;
                    this.textStyleObj.demo2 = this.textStyleObj.demo2 ? false : true;
                }
            }
        }

        Vue.createApp(myApp).mount("#app");
    </script>
</body>
</html>